import java.util.Arrays;

class A{
    @Override
    public String toString() {
        return "111";
    }
}
class Ad{

}

public class doubleArray {
    public static void main(String[] args){
        System.out.println(new A());
    }



    //辗转相除法
    public static int gcd(int a,int b){
        if(b == 0)
            return a;
        else{

            return gcd(b,a % b);

        }
    }

    public static void main6(String[] args) {
        int ret = gcd(24,16);
        System.out.println(ret);
    }


    //只出现一次的数字（一个数组中有两个只出现一次的数字）
    public static int[] doubleSearch(int[] array) {
        int[] ret = new int[2];
        int pos = array[0];
        for (int i = 1; i < array.length; i++) {
            pos ^= array[i];
        }
        int num = 0;
        for (num = 0; num < 32; num++) {
            if (((pos >> num) & 1) == 1) {
                break;
            }
        }
            for (int j = 0; j < array.length; j++) {
                if ((array[j] >> num & 1) == 1) {
                    ret[0] ^= array[j];
                } else {
                    ret[1] ^= array[j];
                }
            }
            return ret;
    }

    public static void main5(String[] args) {
        int[] array = {1,2,3,4,2,1};
        int[] ret = doubleSearch(array);
        System.out.println(Arrays.toString(ret));

    }

    //只出现一次的数字(for)
    public static int search(int[] array) {
        int ret = array[0];
        for (int i = 1; i < array.length; i++) {
            ret ^= array[i];
        }
        return ret;
    }
    //只出现一次的数字(foreach)
    public static int research(int[] array) {
        int ret = 0;
        for(int x : array){
            ret ^= x;
        }
        return ret;
    }




    //找数组中两数之和
    public static int[] func2(int[] array,int target) {
        int[] ret = new int[2];
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if (array[i] + array[j] == target) {
                    ret[0] = i;
                    ret[1] = j;
                    return ret;
                }
            }
        }
        return ret;
    }



    //奇数位于偶数之前
    public static void fun(int[] array) {
        int i = 0;
        int j = array.length-1;
        while(i < j){
            while((i < j) && i % 2 != 0){
                i++;
            }
            while((i < j) && j % 2 == 0){
                j--;
            }
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;//交换完后条件满足循环继续
        }
    }




    public static void transforn(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = array[i] * 2;
        }
    }
    public static int[] transform(int[] array) {
        int[] tmparr = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            tmparr[i] = array[i] * 2;
        }
        return tmparr;
    }    public static void main4(String[] args) {
        int[] array = {1,2,3,4,5};
        int[] tmp = transform(array);
        System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(tmp));
    }

    public static void main3(String[] args) {
        //不规则数组
        int[][] array = new int[2][];
//        System.out.println(array);//引用中存放的地址
//        System.out.println(array[0]);//数组中存放的地址
//        System.out.println(Arrays.toString(array[0]));
//        System.out.println(array[1]);//数组中存放的地址
//        System.out.println(Arrays.toString(array[1]));
        array[1] = new int[3];
        array[0] = new int[4];
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j]+" ");
            }
            System.out.println();
        }

    }


    public static void main2(String[] args) {
        //二维数组
        int[][] array = new int[][]{{1,2,3},{3,4,5}};
        int[][] array1 = new int[2][3];
        int[][] array2 = {{1,2,3},{4,5,6}};
        //二维数组的遍历
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j]+" ");
            }
            System.out.println();
        }
        //用Arrays.toString进行遍历
        System.out.println(Arrays.toString(array));//打印出两个地址，不是我们想要的数组元素
        System.out.println(array[0]);
        System.out.println(Arrays.toString(array[0]));
        System.out.println(array[1]);
        System.out.println(Arrays.toString(array[1]));
        //用Arrays.deepToString进行遍历
        System.out.println(Arrays.deepToString(array));
for(int[] arr : array) {
    for(int x : arr){
        System.out.print (x + " ");
    }
    System.out.println();
        }

    }
















    //冒泡排序
    public static void bubblesort(int[] array) {
        //控制趟数
        for (int i = 0; i < array.length-1; i++) {
            //优化 检查每一趟过后是否有序，如果有序则直接结束方法
            boolean flg = false;
            //array。length-1-i  优化的是每一趟比较的次数
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j] > array[j+1]){
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                    flg = true;
                }
                if(flg == false) {
                    return;
                }
            }
        }
    }

    public static void main1(String[] args) {
        int[] array = {12,5,8,3,6,7};
        bubblesort(array);
        System.out.println(Arrays.toString(array));
    }
}
